#ifndef GAMEEVENTMANAGER_H
#define GAMEEVENTMANAGER_H

#include <vector>
#include <list>
#include <map>

#include "IGameEventListener.h"

class GameEventManager
{
public:
	GameEventManager(void);
	~GameEventManager(void);
	bool addListener(const EventListenerPtr &listener, const EventType type);
	bool removeListener(const EventListenerPtr &listener, const EventType type);
	bool queueEvent(const EventPtr &event);
	bool process(const unsigned long maxMs);
	void emptyQueues(void);
private:
	typedef std::list<EventListenerPtr> EventListenerTable;
	typedef std::map<EventType, EventListenerTable> EventListenerMap;
	typedef std::pair<EventType, EventListenerTable> EventListenerMapEntry;
	EventListenerMap mmRegistry;
	typedef std::list<EventPtr> EventQueues;
	EventQueues maQueues[2];
	int miActiveQueue;
};

#endif